package comp.comp.wxxcx_login.controller;

import java.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.*;
import org.springframework.http.*;
import org.springframework.data.domain.*;
import org.springframework.web.bind.annotation.*;

import com.justep.cloud.microservice.http.*;
import com.justep.cloud.microservice.*;


import comp.comp.wxxcx_login.service.X5ThirdPartyLoginService;


@RestController
public class ThirdPartyLoginController extends MicroServiceBaseController {
	private static final Logger logger = LoggerFactory.getLogger(ThirdPartyLoginController.class);
	static Map<String, Map<String, Integer>> exceptionStatusMap = new HashMap<String, Map<String, Integer>>();
	static {
		Map<String, Integer> map = new HashMap<String, Integer>();
		exceptionStatusMap.put("login2Uaa", map);
	}		
	static {
		Map<String, Integer> map = new HashMap<String, Integer>();
		exceptionStatusMap.put("getOpenId", map);
	}		
	static {
		Map<String, Integer> map = new HashMap<String, Integer>();
		exceptionStatusMap.put("getUserInfo", map);
	}		
	static {
		Map<String, Integer> map = new HashMap<String, Integer>();
		exceptionStatusMap.put("wxCallback", map);
	}		
	@Autowired
	@Qualifier("x5ThirdPartyLoginService")
	private X5ThirdPartyLoginService service;

	//系统生成代码,请不要修改或删除 <actionStart:login2Uaa>
@RequestMapping(value = "/wxxcx_login/thirdpartylogin/login2Uaa", method = RequestMethod.POST)
	public ResponseEntity<String> login2Uaa(


@RequestBody String data
) throws Exception {
		try {
String resp = service.login2Uaa(data);
HttpHeaders headers = new HttpHeaders();
headers.putAll(getSystemHeader());
processContentType(headers);
ResponseEntity<String> ret = new ResponseEntity<String>(resp,headers,HttpStatus.OK);
return ret;
		} catch (ActionException ex) {
			ex.setActionName("login2Uaa");
			throw ex;
		}
	}
	//系统生成代码,请不要修改或删除 <actionEnd:login2Uaa>
	//系统生成代码,请不要修改或删除 <actionStart:getOpenId>
@RequestMapping(value = "/wxxcx_login/thirdpartylogin/getOpenId", method = RequestMethod.GET)
	public ResponseEntity<String> getOpenId(


@RequestParam(name = "code" ) String code
) throws Exception {
		try {
String resp = service.getOpenId(code);
HttpHeaders headers = new HttpHeaders();
headers.putAll(getSystemHeader());
processContentType(headers);
ResponseEntity<String> ret = new ResponseEntity<String>(resp,headers,HttpStatus.OK);
return ret;
		} catch (ActionException ex) {
			ex.setActionName("getOpenId");
			throw ex;
		}
	}
	//系统生成代码,请不要修改或删除 <actionEnd:getOpenId>
	//系统生成代码,请不要修改或删除 <actionStart:getUserInfo>
@RequestMapping(value = "/wxxcx_login/thirdpartylogin/getUserInfo", method = RequestMethod.POST)
	public ResponseEntity<String> getUserInfo(


@RequestBody String data
) throws Exception {
		try {
String resp = service.getUserInfo(data);
HttpHeaders headers = new HttpHeaders();
headers.putAll(getSystemHeader());
processContentType(headers);
ResponseEntity<String> ret = new ResponseEntity<String>(resp,headers,HttpStatus.OK);
return ret;
		} catch (ActionException ex) {
			ex.setActionName("getUserInfo");
			throw ex;
		}
	}
	//系统生成代码,请不要修改或删除 <actionEnd:getUserInfo>
	//系统生成代码,请不要修改或删除 <actionStart:wxCallback>
@RequestMapping(value = "/wxxcx_login/thirdpartylogin/wxCallback", method = RequestMethod.GET)
	public ResponseEntity wxCallback(


@RequestParam(name = "code" ) String code,
			@RequestParam(name = "params" ) String params
) throws Exception {
		try {
service.wxCallback(code,params);
HttpHeaders headers = new HttpHeaders();
headers.putAll(getSystemHeader());
processContentType(headers);
ResponseEntity ret = new ResponseEntity(headers,HttpStatus.OK);
return ret;
		} catch (ActionException ex) {
			ex.setActionName("wxCallback");
			throw ex;
		}
	}
	//系统生成代码,请不要修改或删除 <actionEnd:wxCallback>
	@Override
	protected Map<String, Map<String, Integer>> getExceptionStatusMap() {
		return exceptionStatusMap;
	}
}
